<template>
	<view>
		<view class="play0">
			<view class="play">
				<view class="play1">
					权限管理
				</view>
				<switch :checked="check1" @click="change" />
			</view>
<!-- 			<view class="play">
				<view class="play1">
					位置权限
				</view>
				<switch :checked="check" />
			</view>
			<view class="play">
				<view class="play1">
					相机权限
				</view>
				<switch :checked="check" />
			</view> -->


		</view>

	</view>
</template>


<script>
	export default {
		data() {
			return {
				listObj: [
					"通讯录权限 ",
					"位置权限",
					"位置权限",

				],
				check: false,
				check1: false

			}

		},
		methods: {
			change() {
				//这个是写在点击事件里面的
				let that = this
				uni.authorize({
					scope: '录音',//这里选择scope.(录音、位置、用户信息...都可以)
					success() { //1.1 允许授权
					},
					fail() { // 拒绝授权
						uni.showModal({
						    content: '检测到小程序部分功能权限，是否去设置打开？',
							confirmText: "确认",
							cancelText: '取消',
							success: (res) => {
								if (res.confirm) {
									uni.openSetting({//opensetting是调起设置页面的
										success: (res) => {
											console.log(res.authSetting);
												if(res.authSetting == true){//判断res.authsetting的值是true还是false


												}else{
													console.log("什么也不做");
													}	
												}
											})
									} else {
										console.log('取消');
										return false;
									}
								}
							})
							return false;
						}
					})
			}
		}
	}
</script>

<style>
	.zh {
		margin-top: 16rpx;
		text-indent: 16rpx;
	}


	.play {
		display: flex;
		background-color: #ffffff;
		justify-content: space-between;
		align-items: center;
		padding: 0 32rpx;
		border-bottom: 1rpx solid #e0e0e0;
	}

	.play1 {
		margin: 1upx 10rpx;
		line-height: 140rpx;
		text-align: left;
		color: #777;
		font-size: 32rpx;

	}

	.play2 {
		margin: 1upx 10rpx;
		line-height: 140rpx;
		text-align: left;
		color: #777;
		font-size: 32rpx;
		text-indent: 24rpx;
		background-color: #ffffff;
		border-bottom: 1rpx solid #e0e0e0;

	}

	.background {
		display: flex;
	}

	.uni-list-cell-db {
		width: 500px;
	}

	.ll1 {
		align-items: flex-end;
	}
</style>
